home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: usinternet.com!not-for-mail
- From: Scott Jibben <sjibben@usinternet.com>
- Subject: Re: Pointers to member functions HOW?
- Message-ID: <31127EE6.30E3@usinternet.com>
- Date: Fri, 02 Feb 1996 15:15:18 -0600
- Organization: Jibben Software
- X-Mailer: Mozilla 2.0b6a (WinNT; I)
- MIME-Version: 1.0
- References: <31067074.6B53@compuserve.com> <4e9nh8$iji@news2.ios.com> <31113B7A.4C82@usinternet.com> <4et7ns$1ur@news2.ios.com>
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- Vlastimil Adamovsky wrote:
- >
- > Scott Jibben <sjibben@usinternet.com> wrote:
- >
- > >Vlastimil Adamovsky wrote:
- > >>
- > >> 1) you cannot cast member function to non-member. It is nonsense
- >
- > >You can if the method is declared as static:
- >
- > >class TTest {
- > >public:
- > > static void MemberFunction(int iVal)
- > > {
- > > printf("[%d]\n", iVal);
- > > };
- > >};
- >
- > It is correct. But "static member function" is not a real member
- > function. It is some kind of "convenience to call it so.
-
- Yes, that is true. The programmer has to be aware of the problems that
- can occur using statics in a class. It may be better to use friend
- functions instead. I have used statics on ocassion, but I sure didn't
- want to. Yet, I needed to be able to pass a function pointer to some
- functions that used those methods. It works, but it has its
- limitations. Like not being able to call other non-static
- methods/members.
-
- I chose to do this because I wanted the functions to be bundled with
- the class. It was limiting, but it fit for the application. However,
- if there would have been a better way, I sure would like to know about
- it. <g>
-
- --
- Scott Jibben, Jibben Software
- Galactic Overlord & Mines of Gorr BBS Door Games
- -----------------------------
- [EMAIL] sjibben@usinternet.com
- [WWW] http://www.usinternet.com/jsw
- [FTP] ftp.europa.com /outgoing/DOORS/jibben
- [FTP] ftp.cts.com /pub/dferber/jibben
- [FIDO] 1:282/115 [BBS] 612-379-8272 (10 USR 28.8 Couriers)
- [VOICE] 612-757-5626 [FAX] 612-757-8687
-
-